import 'package:json_annotation/json_annotation.dart';

part 'recipe_today_api.g.dart';

@JsonSerializable()
class ResponseRecipeTodayApi {
  final int total;
  final List<RecipeToday> rows;

  ResponseRecipeTodayApi({required this.total, required this.rows});

  factory ResponseRecipeTodayApi.fromJson(Map<String, dynamic> json) =>
      _$ResponseRecipeTodayApiFromJson(json);

  Map<String, dynamic> toJson() => _$ResponseRecipeTodayApiToJson(this);
}

@JsonSerializable()
class RecipeToday {
  final String id;
  final String name;
  final String? imageUrls; // imageUrls: 可能是一个图片链接，也可能是多个图片链接用“，”分割，显示时只取第一个
  final String? mainImg; // mainImg: 可能是一个图片链接，也可能是多个图片链接用“，”分割，显示时只取第一个
  final String? videoCoverUrls;
  final String? view;
  final String? likes;
  final String? collection;
  final int? isControl;

  RecipeToday({
    required this.id,
    required this.name,
    this.imageUrls,
    this.videoCoverUrls,
    this.mainImg,
    this.view,
    this.likes,
    this.collection,
    this.isControl,
  });

  factory RecipeToday.fromJson(Map<String, dynamic> json) =>
      _$RecipeTodayFromJson(json);

  Map<String, dynamic> toJson() => _$RecipeTodayToJson(this);
}
